package com.miao.edu.user.api;


import com.miao.edu.user.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author niemiao
 */
@FeignClient(path = "/user",name = "edu-user-boot")
public interface UserRemoteService {

    /**
     * 判断该手机号码是否注册过
     * @param phone
     * @return
     */
    @GetMapping("/isRegister")
    boolean isRegister(@RequestParam("phone") String phone);

    /**
     * 根据电话号码获取用户信息
     * @param phone
     * @return
     */
    @GetMapping("/getUserByPhone")
    UserDTO getUserByPhone(@RequestParam("phone") String phone);


    /**
     * 为第一次登录的用户进行默认注册，此时前台传来的信息包括（手机，验证码，密码）
     * @param userDTO
     * @return
     */
    @PostMapping("/saveUser")
    UserDTO saveUser(@RequestBody UserDTO userDTO);

    /**
     * 根据用户Id获取用户
     * @param userId
     * @return
     */
    @GetMapping("/getUserById")
    UserDTO getUserById(Integer userId);
}
